<?php
/**
 * Created by PhpStorm.
 * User: wzy12
 * Date: 2018/10/10
 * Time: 14:08
 */

namespace app\common\model;


use think\Model;

class Config extends Model
{
    public function resList($data){
        $list = $this -> where($data) -> field('id,name,value,key,inc_type,input_type') -> paginate(10);

        return $list;
    }

    public function operation($data){
        $result = $this -> validate(true) -> allowField(true) -> isUpdate(true) -> save($data);

        if(false === $result){
            return echoArr(0, $this -> getError());
        }else{
            return echoArr(1, '操作成功', ['type' => $data['type']]);
        }
    }
}